package br.com.saeng2D.exec;

import java.awt.Dimension;
import java.awt.Toolkit;

import br.com.saeng2D.formulario.FormularioPrincipal;
import br.com.saeng2D.util.Util;

//Cria uma instancia da aplicacao SAENG2D
public class ExecSaeng2D {
	public static void main(String args[]) {
		java.awt.EventQueue.invokeLater(new Runnable() {
			public void run() {
				// Nova intancia da aplicacao
				FormularioPrincipal formulario = new FormularioPrincipal();
				if("CENTRO".equalsIgnoreCase(Util.getString("modo_abertura"))) {
					formulario.pack();
					formulario.setLocationRelativeTo(null);
				} else if("DIREITO".equalsIgnoreCase(Util.getString("modo_abertura"))) {
					formulario.pack();
					Dimension f = formulario.getSize();
					Dimension v = Toolkit.getDefaultToolkit().getScreenSize();
					v.width -= f.width;
					formulario.setLocation(v.width, (v.height - f.height) / 2);
				} else if("ESQUERDO".equalsIgnoreCase(Util.getString("modo_abertura"))) {
					formulario.pack();
					Dimension f = formulario.getSize();
					Dimension v = Toolkit.getDefaultToolkit().getScreenSize();
					formulario.setLocation(0, (v.height - f.height) / 2);
				} else if("MAXIMIZADO".equalsIgnoreCase(Util.getString("modo_abertura"))) {
					formulario.setExtendedState(FormularioPrincipal.MAXIMIZED_BOTH);
				}
				formulario.setVisible(true);
			}
		});
	}
}